﻿cmake_minimum_required(VERSION 3.24.4)
project(api)

set(CMAKE_CXX_STANDARD 20)
set(SOURCE_FILES main.cpp)
find_package(oatpp REQUIRED)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})

include_directories(./open-data-access-cpp)

target_link_libraries(${PROJECT_NAME} oatpp::oatpp)
target_link_libraries(api curl)

# windows
#include_directories(MySqlTest "C:\\Program Files\\MySQL\\MySQL Connector C++ 8.0\\include")
#link_directories(MySqlTest "C:\\Program Files\\MySQL\\MySQL Connector C++ 8.0\\lib64\\vs14")
#target_link_libraries(MySqlTest "C:\\Program Files\\MySQL\\MySQL Connector C++ 8.0\\lib64\\vs14\\mysqlcppconn.lib")

# mac
#include_directories(/usr/local/mysql-connector-c++-8.0.33/include)
#link_directories(/usr/local/mysql-connector-c++-8.0.33/lib64)
#target_link_libraries(api /usr/local/mysql-connector-c++-8.0.33/lib64/libmysqlcppconn.dylib)

# debian
#include_directories(/usr/local/mysql/connector-c++-/include)
#link_directories(/usr/local/mysql/connector-c++-/lib64)
#target_link_libraries(api libmysqlcppconn.so)

# cmake ../ -DCMAKE_BUILD_TYPE=Release -DWITH_JDBC=true

#IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
#    include_directories(/usr/local/mysql/connector-c++-/include)
#    link_directories(/usr/local/mysql/connector-c++-/lib64)
#    target_link_libraries(api libmysqlcppconn.so)
#elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
#    include_directories(MySqlTest "C:\\Program Files\\MySQL\\MySQL Connector C++ 8.0\\include")
#    link_directories(MySqlTest "C:\\Program Files\\MySQL\\MySQL Connector C++ 8.0\\lib64\\vs14")
#    target_link_libraries(MySqlTest "C:\\Program Files\\MySQL\\MySQL Connector C++ 8.0\\lib64\\vs14\\mysqlcppconn.lib")
#else ()
#    include_directories(/usr/local/mysql-connector-c++-8.0.33/include)
#    link_directories(/usr/local/mysql-connector-c++-8.0.33/lib64)
#    target_link_libraries(api /usr/local/mysql-connector-c++-8.0.33/lib64/libmysqlcppconn.dylib)
#ENDIF()

IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
    include_directories(/www/server/mysql/include)
    link_libraries(/www/server/mysql/lib)
    target_link_libraries(api /www/server/mysql/lib/libmysqlclient.so.21.1.24)
    include_directories(/usr/local/include)
    link_directories(/usr/local/lab)
    target_link_libraries(api libxlsxwriter.a)
    target_link_libraries(api libz.a)
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
    include_directories("C:\\Program Files\\MySQL\\MySQL Server 8.0\\include")
    link_libraries("C:\\Program Files\\MySQL\\MySQL Server 8.0\\lib")
    target_link_libraries(api "C:\\Program Files\\MySQL\\MySQL Server 8.0\\lib\\libmysql.lib")
else ()
    include_directories(/usr/local/mysql/include)
    link_directories(/usr/local/mysql/lib)
    target_link_libraries(api /usr/local/mysql/lib/libmysqlclient.dylib)
ENDIF()